package com.tally.server.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tally.server.enums.IncomeTypeEnum;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class EverydayIncomeDTO {
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    private Date recordDate;

    private Map<String, BigDecimal> typeMoneyMap = new HashMap<>();

    private BigDecimal sum;

    public EverydayIncomeDTO(){}

    public EverydayIncomeDTO(Date recordDate) {
        this.recordDate = recordDate;
        for (IncomeTypeEnum incomeTypeEnum : IncomeTypeEnum.values()) {
            this.typeMoneyMap.put(incomeTypeEnum.getDesc(), BigDecimal.ZERO);
        }
        this.sum = BigDecimal.ZERO;
    }

    public Date getRecordDate() {
        return recordDate;
    }

    public void setRecordDate(Date recordDate) {
        this.recordDate = recordDate;
    }

    public Map<String, BigDecimal> getTypeMoneyMap() {
        return typeMoneyMap;
    }

    public void setTypeMoneyMap(Map<String, BigDecimal> typeMoneyMap) {
        this.typeMoneyMap = typeMoneyMap;
    }

    public BigDecimal getSum() {
        return sum;
    }

    public void setSum(BigDecimal sum) {
        this.sum = sum;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("EverydayIncomeDTO{");
        sb.append("recordDate=").append(recordDate);
        sb.append(", typeMoneyMap=").append(typeMoneyMap);
        sb.append(", sum=").append(sum);
        sb.append('}');
        return sb.toString();
    }
}
